package cn.smbms.controller;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: laoyu
 * @Date: 2019/9/2 10:12
 * @Description:
 */
public class BaseController {
    @InitBinder
    public void initBinder(WebDataBinder dataBinder){
        System.out.println("dataBinder==========================");
        dataBinder.registerCustomEditor(Date.class,
                new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"),true));
    }
}
